package org.hamster.multidropbox.dropbox.vo
{
	import mx.collections.ArrayCollection;
	
	import org.hamster.multidropbox.main.constants.AppStatus;
	import org.hamster.multidropbox.main.vo.IStorableVO;

	public class AppDropboxLinkFoldersVO implements IStorableVO
	{
		public var folderName:String;
		public var itemList:Array = new Array();
		
		public function AppDropboxLinkFoldersVO()
		{
		}
		
		public function encodeXML():XML
		{
			var result:XML = <link-folder folder-name={folderName}></link-folder>;
			if (itemList) {
				for each (var item:AppDropboxLinkFolderItemVO in itemList) {
					result.appendChild(item.encodeXML());
				}
			}
			return result;
		}
		
		public function decodeXML(value:XML):void
		{
			this.folderName 		= value.attribute('folder-name');
			this.itemList           = new Array();
			for each (var xmlItem:XML in value.children()) {
				var obj:AppDropboxLinkFolderItemVO = new AppDropboxLinkFolderItemVO();
				obj.decodeXML(xmlItem);
				this.itemList.push(obj);
			}
		}
	}
}